package com.yzf.wisecoder.wisecodercommon.utils;

import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.google.common.collect.Lists;

import java.util.List;

/**
 * @author jianghuiyong
 * @ClassName: BeanUtils
 * @description: TODO
 * @date 2019/7/4 15:20
 */
public class BeanCopyUtils {

    public static <T> List<T> copyList(List list, Class<T> tClass) {
        if (CollectionUtil.isEmpty(list)) {
            return Lists.newArrayList();
        }
        List<T> targetList = JSONArray.parseArray(JSON.toJSONString(list), tClass);
        return targetList;
    }
}
